<?php

namespace app\index\controller;

class SettlementCustomerBase
{
    public function index()
    {
        $query = \app\model\SettlementCustomer::field(['id', 'customer_name', 'amount', 'electricity'])->order('id', 'desc');

        if ($settlement_id = input('settlementId')) {
            $query->where('settlement_id', $settlement_id);
        }

        $models = $query->select();

        return json(['code' => 20000, 'data' => ['settlementCustomers' => $models]]);
    }
}
